home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / SAT / SATminimal ƒ / SATminimal.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-21  |  1.5 KB  |  61 lines  |  [TEXT/KAHL]

  1. #include "SAT.h"
  2.  
  3. /* program SATminimal; */
  4.  
  5. /* MySprite's interface */
  6. extern void InitMySprite();
  7. extern pascal void SetupMySprite (SpritePtr);
  8. extern pascal void HandleMySprite (SpritePtr);
  9.  
  10. main()
  11. {
  12.         WindowPtr gameWind;
  13.         SpritePtr ignoreSp;
  14.         long L;
  15.  
  16. /* ThinkC doesn't initialize automatically, so we must do that ourselves? */
  17.  
  18.     MaxApplZone ();
  19.     FlushEvents (everyEvent - diskMask, 0 );
  20.     InitGraf (&thePort);
  21.     InitFonts ();
  22.     InitWindows ();
  23.     InitMenus ();
  24.     TEInit ();
  25.     InitDialogs (nil);        /* no restart proc */
  26.     InitCursor ();
  27.  
  28.     MoreMasters ();
  29.     MoreMasters ();
  30.  
  31.  
  32. /* End of initializations */
  33.  
  34.     gameWind = InitSAT(128, 129, 512, 322);
  35.  
  36.     InitMySprite(); /* Preload sprite data */
  37.  
  38.     ShowWindow(SATwind);
  39.     SelectWindow(SATwind); /* Show the window (SATwind and gameWind are the same) */
  40.  
  41.     PeekOffscreen(); /* Update the window */
  42.  
  43. /* Make a few sprites */
  44.     ignoreSp = NewSprite(0, 50, 50, HandleMySprite, SetupMySprite, nil);
  45.     ignoreSp = NewSprite(0, 100, 100, HandleMySprite, SetupMySprite, nil);
  46.     ignoreSp = NewSprite(0, 125, 120, HandleMySprite, SetupMySprite, nil);
  47.     ignoreSp = NewSprite(0, 150, 140, HandleMySprite, SetupMySprite, nil);
  48.     ignoreSp = NewSprite(0, 200, 180, HandleMySprite, SetupMySprite, nil);
  49.     ignoreSp = NewSprite(0, 250, 200, HandleMySprite, SetupMySprite, nil);
  50.     ignoreSp = NewSprite(0, 300, 250, HandleMySprite, SetupMySprite, nil);
  51.  
  52.     while (!Button())
  53.     {
  54.         L = TickCount();
  55.         RunSAT(true); /* Run the animation */
  56.         while (L > TickCount() - 2L) /* Speed limit */
  57.             ;
  58.     }
  59.     SATSoundShutup(); /* Always make sure the channel is de-allocated */
  60. }
  61.